package com.sheepone.distributor.test;

import com.sheepone.distributor.Distributor;
import com.sheepone.distributor.anno.StationEventListener;
import com.sheepone.distributor.listener.WorkerEventListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author Miss.杨
 * @description
 * @since 2023-12-13 17:32
 */
@Slf4j
@StationEventListener(station = StationConstants.ADD, topic = TopicConstants.ADD)
public class AddStringListener implements WorkerEventListener<StringContext> {
    @Autowired
    Distributor distributor;

    @Override
    public void onEvent(StringContext context) {
        context.setValue(context.getValue() + context.getValue());
        distributor.distribute(StationConstants.READ, TopicConstants.READ, context);
    }
}
